package cn.imvc.app.models;

import java.util.Date;
import java.util.Map;

import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;

import cn.imvc.app.domains.AppResult;
import cn.imvc.app.domains.GenerateOrderInfo;
import cn.imvc.app.entities.Member;
import cn.imvc.app.entities.Orders;
import cn.imvc.app.entities.StorageOrder;

public interface OrderModel {
	/**
	 * 展示提交订单页面信息
	 * @param member
	 * @param goodsInfoStr
	 * @param addressId 
	 * @param singleBuyFlag 
	 * @return
	 */
	Map<String,Object> updateCartsAndshowPreOrderInfo(Member member, String goodsInfoStr, Integer addressId,boolean singleBuyFlag);
	/**
	 * 生成 三级订单
	 * @param member
	 * @param orderInfo
	 * @return
	 */
	Map<String, Object> saveGeneratedOrders(Member member,GenerateOrderInfo orderInfo);
	
	Orders get(int id);
	
	Orders findByCode(String code);
	
	Orders save(Orders entity);
	
	void finishPay(String code,String payCode,Date payTime);
	
	Page<Orders> findByState(Byte state,Integer memberId,PageRequest pageRequest);
	
	Page<Orders> findByStateTwoLevel(Byte state,Member member,PageRequest pageRequest);
	
	AppResult cancelOrder(Member member,Integer orderId);
	
	AppResult cancelPayOrder(Member member,Integer orderId);
	
	AppResult receiptStorageOrder(Member member,Integer orderId);
	
	StorageOrder getStorageOrder(Integer storageOrderId);
	/**
	 * 展示积分消费订单结算页
	 * @param member
	 * @param goodsInfoStr
	 * @param addressId 
	 * @param singleBuyFlag 
	 * @return
	 */
	Map<String,Object> pointsBuyPreOrderInfo(Member member, String goodsInfoStr, Integer addressId);
	/**
	 * 积分消费 生成 三级订单
	 * @param member
	 * @param orderInfo
	 * @return
	 */
	Map<String, Object> savePointsBuy(Member member,GenerateOrderInfo orderInfo);
	StringBuffer getMemberStr(Member member);
}
